package com.easy.auth.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;

import com.easy.auth.domain.Reportlog;
import com.easy.auth.service.ReportlogService;
import com.easy.base.service.impl.EManagerImpl;
import com.easy.common.jdbc.PageInfo;
import com.easy.common.web.PagedList;

@Service
public class ReportlogServiceImpl extends EManagerImpl<Reportlog> implements
		ReportlogService {
	@Override
	public	PagedList<Reportlog> getAllReportlogsLike(Reportlog reportlog, PageInfo pageInfo){
		return super.findAllLike(reportlog, pageInfo);
	}
	
	
	@Override
	public PagedList<Reportlog> getAllReportlogs() {
		List<Reportlog> ReportlogList = super.findList(new Reportlog());
		return new PagedList<Reportlog>(ReportlogList);
	}
	@Override
	public PagedList<Reportlog> getLastFiveReportlog() {
		PageInfo pageInfo =new PageInfo();
		pageInfo.setSort("last_modify_time");
		pageInfo.setRows(5);
		return super.findAllLike(new Reportlog(), pageInfo);
	}
	
	
	@Override
	public PagedList<Reportlog> getTop10Reportlogs() {
		PageInfo pageInfo=new PageInfo(6,0,"desc","last_modify_time");
		return super.findAllEqual(new Reportlog(), pageInfo);
	}
	@Override
	public int saveReportlog(Reportlog Reportlog) {
		return super.save(Reportlog);
	}

	@Override
	public Reportlog findReportlogById(Reportlog Reportlog) {
		return super.findByOid(Reportlog);
	}

	@Override
	public int removeReportlogs(String[] oids) {
		List<Reportlog> deptlist = new ArrayList<Reportlog>();
		for (String oid : oids) {
			Reportlog Reportlog = new Reportlog();
			Reportlog.setOid(oid);
			deptlist.add(Reportlog);
		}
		return super.removeAll(deptlist);
	}
}